package com.asiainfo.exec.task;

import com.alibaba.fastjson.JSON;
import com.asiainfo.exec.args.UpdateDataArgs;
import com.asiainfo.exec.core.TaskRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

/**
 * 更新数据例子
 */
@Service("update")
public class UpdateDataTask implements TaskRunner<UpdateDataArgs> {

    private final static Logger LOGGER = LoggerFactory.getLogger(UpdateDataTask.class);

    @Override
    public void run(UpdateDataArgs args) throws Exception {
        LOGGER.info("开始运行Update任务 传入参数: {}", JSON.toJSONString(args));
        if (args.isUpdateUser()) {
            LOGGER.info("==========> 开始更新用户数据 <===========");
            Thread.sleep(10000L);
            LOGGER.info("==========> 完成更新用户数据 <===========");
        }
        LOGGER.info("运行Update任务完成");
    }

}
